package com.vshop.controller.simple;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.vshop.entity.comentity.PackageMarketingStrategy;
import com.vshop.entity.comentity.PartnerPackage;
import com.vshop.entity.interfacerequest.ExceptionRequest;
import com.vshop.entity.interfacerequest.simplehomepagenew.request.RequestSimpleHomePageNew;
import com.vshop.entity.interfacerequest.simplehomepagenew.request.RequestSimpleHomePageNewData;
import com.vshop.entity.interfacerequest.simplehomepagenew.response.ResponseSimpleHomePageNew;
import com.vshop.entity.interfacerequest.simplehomepagenew.response.ResponseSimpleHomePageNewData;
import com.vshop.entity.interfacerequest.simplehomepagenew.response.ResponseSimpleHomePageNewTradeData;
import com.vshop.mapper.alast.LogicProcessesMapper;
import com.vshop.service.PackageMarketingStrategyService;
import com.vshop.service.PartnerInfoService;
import com.vshop.service.PartnerPackageService;
import com.vshop.service.SequenceService;
import com.vshop.utils.Md5Encrypt;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * 精简版的首页接口
 *
 * @author lm
 * @date 2019/05/16
 */
@RestController
@Api(description = "新-精简版的首页")
@Slf4j
public class SimpleHomePageNewController {
    @Autowired
    private SequenceService sequenceService;
    @Autowired
    private PartnerPackageService partnerPackageService;
    @Autowired
    private PackageMarketingStrategyService packageMarketingStrategyService;
    @Autowired
    PartnerInfoService partnerInfoService;

    @Resource
    LogicProcessesMapper logicMapper;

    @CrossOrigin
    @PostMapping(value = "simpleHomePageNew", produces = "application/json;charset=utf-8")
    @ResponseBody
    @ApiOperation(value = "新-精简版的首页", response = ResponseSimpleHomePageNew.class)
    public String simpleHomePageNew(@ApiParam @RequestBody RequestSimpleHomePageNew request) {
        // 1，生成流水号
        String connSeqNo = sequenceService.getPackageTaskNo();
        // 2,生成当前时间戳
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String curtime = df.format(new Date());

        //3,定义要回复的内容
        String jsonString;

        ExceptionRequest utils = new ExceptionRequest();
        String requestStr = JSON.toJSONString(request);
        if (null == requestStr) {
            log.info("请求报文不合法:requestStr为空");
            jsonString = utils.dataWeiKong(connSeqNo, curtime);
            return jsonString;
        } else {
            log.info("【新-精简版的首页】请求：" + requestStr);
            RequestSimpleHomePageNew requestPackage = JSONArray.parseObject(requestStr, RequestSimpleHomePageNew.class);
            String requestSign = requestPackage.getSign();
            if (requestPackage.getSign() == null) {
                log.info("请求报文不合法:sign为空");
                jsonString = utils.dataWeiKong(connSeqNo, curtime);
                return jsonString;
            } else {
                RequestSimpleHomePageNewData requestData = requestPackage.getData();
                if (requestPackage.getData() == null) {
                    log.info("请求报文不合法:data为空");
                    jsonString = utils.dataWeiKong(connSeqNo, curtime);
                    return jsonString;
                } else {

                    String ConnSeqNo = requestData.getConnSeqNo();
                    String partnerCode = requestData.getPartnerCode();
                    String tradeTime = requestData.getTradeTime();
                    String tradeType = requestData.getTradeType();
                    String lang = requestData.getLang();
                    String version = requestData.getVersion();
                    String deviceCode = requestData.getDeviceCode();

                    if (StringUtils.isBlank(ConnSeqNo) || StringUtils.isBlank(partnerCode) || StringUtils.isBlank(tradeTime) || StringUtils.isBlank(tradeType) || lang == null || version == null || StringUtils.isBlank(deviceCode)) {
                        log.info("请求报文不合法:data参数不合法");
                        jsonString = utils.dataWeiKong(connSeqNo, curtime);
                        return jsonString;
                    } else {

                        String str = JSON.toJSONString(requestData);
                        String sign = utils.calculateSignature(str);
                        log.info("计算的签名是：" + sign);
                        if (!requestSign.equalsIgnoreCase(sign)) {
                            if (lang.equals("en")) {
                                jsonString = utils.signatureFailure(ConnSeqNo, tradeTime, tradeType, "0001", "The signature is wrong, please confirm the signature!");
                                return jsonString;
                            } else {
                                jsonString = utils.signatureFailure(ConnSeqNo, tradeTime, tradeType, "0001", "签名有误,请确认签名!");
                                return jsonString;
                            }

                        } else {
                            //签名通过
                            List<ResponseSimpleHomePageNewTradeData> tradeDataList = new ArrayList<ResponseSimpleHomePageNewTradeData>();
                            ResponseSimpleHomePageNewTradeData tradeData = null;

                            if (StringUtils.isNotBlank(partnerCode)) {

                                List<PartnerPackage> PartnerPackageList = null;

                                // 根据partnerIndex分别去分库里面取相应的卡片与套餐对应关系的数据：
                                Integer partnerIndex = Integer.parseInt(partnerInfoService.getPartnerIndex(partnerCode));
                                switch (partnerIndex) {
                                    case 0:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_0(partnerCode, deviceCode);
                                        break;
                                    case 1:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_1(partnerCode, deviceCode);
                                        break;
                                    case 2:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_2(partnerCode, deviceCode);
                                        break;
                                    case 3:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_3(partnerCode, deviceCode);
                                        break;
                                    case 4:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_4(partnerCode, deviceCode);
                                        break;
                                    case 5:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_5(partnerCode, deviceCode);
                                        break;
                                    case 6:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_6(partnerCode, deviceCode);
                                        break;
                                    case 7:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_7(partnerCode, deviceCode);
                                        break;
                                    case 8:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_8(partnerCode, deviceCode);
                                        break;
                                    case 9:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode_9(partnerCode, deviceCode);
                                        break;
                                    default:
                                        PartnerPackageList = partnerPackageService.querySimplePackageListByPartnerCode(partnerCode, deviceCode);
                                        break;
                                }

                                if (null != PartnerPackageList && PartnerPackageList.size() > 0 && !PartnerPackageList.isEmpty()) {

                                    for (PartnerPackage p : PartnerPackageList) {

                                        String packageCode = p.getPackageCode();

                                        //去取价格信息
                                        List<PackageMarketingStrategy> priceList = packageMarketingStrategyService.queryPageByCodePriceByCode(partnerCode, packageCode);

                                        if (priceList != null && !priceList.isEmpty()) {

                                            for (PackageMarketingStrategy strategy : priceList) {

                                                tradeData = new ResponseSimpleHomePageNewTradeData();

                                                //套餐名称
                                                if (lang.equals("cn")) {

                                                    if (StringUtils.isNotBlank(p.getPackageShortDesc())) {

                                                        tradeData.setPackageDesc(p.getPackageShortDesc());

                                                    } else {

                                                        tradeData.setPackageDesc("");

                                                    }
                                                    tradeData.setPackageName(p.getPackageShowName());

                                                    tradeData.setCoverCountry(p.getCoverCountrys());

                                                    tradeData.setPicDicUrl("");

                                                } else {

                                                    if (StringUtils.isNotBlank(p.getPackageShortDescEN())) {

                                                        tradeData.setPackageDesc(p.getPackageShortDescEN());

                                                    } else {

                                                        tradeData.setPackageDesc("");
                                                    }
                                                    tradeData.setPackageName(p.getPackageNameEN());

                                                    tradeData.setCoverCountry(p.getCoverCountrysEN());

                                                    tradeData.setPicDicUrl("");
                                                }

                                                //套餐编码
                                                tradeData.setPackageCode(p.getPackageCode());

                                                //查询有咩有需要将套餐假处理成0（日程套餐）的渠道
                                                Integer c0 = logicMapper.specialHandleCount(partnerCode, "0");
                                                //查询有咩有需要将套餐假处理成3（季度套餐）的渠道
                                                Integer c3 = logicMapper.specialHandleCount(partnerCode, "3");
                                                //查询有咩有需要将套餐假处理成3（季度套餐）的渠道
                                                Integer c4 = logicMapper.specialHandleCount(partnerCode, "4");

                                                if (c0 >= 1) {
                                                    //大阳不想展示时间选择框，就给他一个假的值，当成日程套餐；
                                                    tradeData.setPackageType("0");
                                                } else if (c3 >= 1) {
                                                    tradeData.setPackageType("3");
                                                    //玖零皓：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //锐锋汇智：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //尔登：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //西安盛龙：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //广州市天腾电子科技有限公司：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //爱卡电子：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //深圳市源富信通电子有限公司：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //2020-5-27日将日天昊：（只展示6个月，12个月，当成半年套餐：
                                                    // else if ("P000598".equals(partnerCode)) {tradeData.setPackageType("4");}）改成（只展示3个月，6个月，12个月，当成季度套餐）
                                                    //麦尔锡：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //深圳市特科思电子有限公司:只展示3个月，6个月，12个月，当成季度套餐；
                                                    //智博通:只展示3个月，6个月，12个月，当成季度套餐；
                                                    //启越：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //康凯斯贸易：只展示3个月，6个月，12个月，当成季度套餐；
                                                    //掌航技术：只展示3个月，6个月，12个月，当成季度套餐；
                                                } else if (c4 >= 1) {
                                                    tradeData.setPackageType("4");
                                                    //深圳市格曼电子商务有限公司：只展示6个月，12个月，当成半年套餐
                                                } else {
                                                    tradeData.setPackageType(p.getPackageType());
                                                }

                                                tradeData.setPriceType(p.getPriceType());
                                                tradeData.setBuyType(p.getBuyType());
                                                tradeData.setPackageFlow(p.getPackageFlow());
                                                tradeData.setPartnerScope(p.getPartnerScope());
                                                tradeData.setMinOrderPeriod(p.getMinOrderPeriod());
                                                tradeData.setMaxOrderPeriod(p.getMaxOrderPeriod());
                                                tradeData.setSalesType(p.getSalesType());
                                                tradeData.setPicDetailspage("");

                                                if (p.getSalesType().equals("1")) {
                                                    //特价
                                                    tradeData.setOriginalPriceCNY(strategy.getOriginalPriceCNY());
                                                    tradeData.setOriginalPriceUSD(strategy.getOriginalPriceUSD());
                                                    tradeData.setSpecialPriceCNY(strategy.getSpecialPriceCNY());
                                                    tradeData.setSpecialPriceUSD(strategy.getSpecialPriceUSD());

                                                    if (StringUtils.isNotBlank(strategy.getOriginalPriceCNY()) && StringUtils.isNotBlank(strategy.getSpecialPriceCNY()) &&
                                                            StringUtils.isNotBlank(strategy.getOriginalPriceUSD()) && StringUtils.isNotBlank(strategy.getSpecialPriceUSD())) {
                                                        tradeData.setSaveCNY(String.format("%.2f", (Double.parseDouble(strategy.getOriginalPriceCNY()) - Double.parseDouble(strategy.getSpecialPriceCNY()))));
                                                        tradeData.setSaveUSD(String.format("%.2f", (Double.parseDouble(strategy.getOriginalPriceUSD()) - Double.parseDouble(strategy.getSpecialPriceUSD()))));
                                                    }


                                                } else {
                                                    tradeData.setOriginalPriceCNY(strategy.getOriginalPriceCNY());
                                                    tradeData.setOriginalPriceUSD(strategy.getOriginalPriceUSD());
                                                }

                                                if (p.getPackageType().equals("2")) {

                                                    //月包

                                                    if (p.getSalesType().equals("1")) {

                                                        //特价
                                                        tradeData.setOrCNY_1(strategy.getOrCNY_1());
                                                        tradeData.setOrUSD_1(strategy.getOrUSD_1());
                                                        tradeData.setSpCNY_1(strategy.getSpCNY_1());
                                                        tradeData.setSpUSD_1(strategy.getSpUSD_1());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_1()) && StringUtils.isNotBlank(strategy.getSpCNY_1()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_1()) && StringUtils.isNotBlank(strategy.getSpUSD_1())) {
                                                            tradeData.setSaveCNY_1(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_1()) - Double.parseDouble(strategy.getSpCNY_1()))));
                                                            tradeData.setSaveUSD_1(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_1()) - Double.parseDouble(strategy.getSpUSD_1()))));
                                                        }

                                                        tradeData.setOrCNY_3(strategy.getOrCNY_3());
                                                        tradeData.setOrUSD_3(strategy.getOrUSD_3());
                                                        tradeData.setSpCNY_3(strategy.getSpCNY_3());
                                                        tradeData.setSpUSD_3(strategy.getSpUSD_3());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_3()) && StringUtils.isNotBlank(strategy.getSpCNY_3()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_3()) && StringUtils.isNotBlank(strategy.getSpUSD_3())) {
                                                            tradeData.setSaveCNY_3(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_3()) - Double.parseDouble(strategy.getSpCNY_3()))));
                                                            tradeData.setSaveUSD_3(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_3()) - Double.parseDouble(strategy.getSpUSD_3()))));
                                                        }

                                                        tradeData.setOrCNY_6(strategy.getOrCNY_6());
                                                        tradeData.setOrUSD_6(strategy.getOrUSD_6());
                                                        tradeData.setSpCNY_6(strategy.getSpCNY_6());
                                                        tradeData.setSpUSD_6(strategy.getSpUSD_6());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_6()) && StringUtils.isNotBlank(strategy.getSpCNY_6()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_6()) && StringUtils.isNotBlank(strategy.getSpUSD_6())) {
                                                            tradeData.setSaveCNY_6(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_6()) - Double.parseDouble(strategy.getSpCNY_6()))));
                                                            tradeData.setSaveUSD_6(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_6()) - Double.parseDouble(strategy.getSpUSD_6()))));
                                                        }

                                                        tradeData.setOrCNY_12(strategy.getOrCNY_12());
                                                        tradeData.setOrUSD_12(strategy.getOrUSD_12());
                                                        tradeData.setSpCNY_12(strategy.getSpCNY_12());
                                                        tradeData.setSpUSD_12(strategy.getSpUSD_12());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_12()) && StringUtils.isNotBlank(strategy.getSpCNY_12()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_12()) && StringUtils.isNotBlank(strategy.getSpUSD_12())) {
                                                            tradeData.setSaveCNY_12(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_12()) - Double.parseDouble(strategy.getSpCNY_12()))));
                                                            tradeData.setSaveUSD_12(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_12()) - Double.parseDouble(strategy.getSpUSD_12()))));
                                                        }

                                                    } else { //热门

                                                        tradeData.setOrCNY_3(strategy.getOrCNY_3());
                                                        tradeData.setOrUSD_3(strategy.getOrUSD_3());

                                                        tradeData.setOrCNY_1(strategy.getOrCNY_1());
                                                        tradeData.setOrUSD_1(strategy.getOrUSD_1());

                                                        tradeData.setOrCNY_6(strategy.getOrCNY_6());
                                                        tradeData.setOrUSD_6(strategy.getOrUSD_6());

                                                        tradeData.setOrCNY_12(strategy.getOrCNY_12());
                                                        tradeData.setOrUSD_12(strategy.getOrUSD_12());
                                                    }


                                                } else if (p.getPackageType().equals("3")) {
                                                    //季度包

                                                    if (p.getSalesType().equals("1")) {
                                                        //特价
                                                        tradeData.setOrCNY_3(strategy.getOrCNY_3());
                                                        tradeData.setOrUSD_3(strategy.getOrUSD_3());
                                                        tradeData.setSpCNY_3(strategy.getSpCNY_3());
                                                        tradeData.setSpUSD_3(strategy.getSpUSD_3());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_3()) && StringUtils.isNotBlank(strategy.getSpCNY_3()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_3()) && StringUtils.isNotBlank(strategy.getSpUSD_3())) {
                                                            tradeData.setSaveCNY_3(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_3()) - Double.parseDouble(strategy.getSpCNY_3()))));
                                                            tradeData.setSaveUSD_3(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_3()) - Double.parseDouble(strategy.getSpUSD_3()))));
                                                        }

                                                        tradeData.setOrCNY_6(strategy.getOrCNY_6());
                                                        tradeData.setOrUSD_6(strategy.getOrUSD_6());
                                                        tradeData.setSpCNY_6(strategy.getSpCNY_6());
                                                        tradeData.setSpUSD_6(strategy.getSpUSD_6());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_6()) && StringUtils.isNotBlank(strategy.getSpCNY_6()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_6()) && StringUtils.isNotBlank(strategy.getSpUSD_6())) {
                                                            tradeData.setSaveCNY_6(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_6()) - Double.parseDouble(strategy.getSpCNY_6()))));
                                                            tradeData.setSaveUSD_6(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_6()) - Double.parseDouble(strategy.getSpUSD_6()))));
                                                        }

                                                        tradeData.setOrCNY_12(strategy.getOrCNY_12());
                                                        tradeData.setOrUSD_12(strategy.getOrUSD_12());
                                                        tradeData.setSpCNY_12(strategy.getSpCNY_12());
                                                        tradeData.setSpUSD_12(strategy.getSpUSD_12());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_12()) && StringUtils.isNotBlank(strategy.getSpCNY_12()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_12()) && StringUtils.isNotBlank(strategy.getSpUSD_12())) {
                                                            tradeData.setSaveCNY_12(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_12()) - Double.parseDouble(strategy.getSpCNY_12()))));
                                                            tradeData.setSaveUSD_12(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_12()) - Double.parseDouble(strategy.getSpUSD_12()))));
                                                        }
                                                    } else {  //季度套餐热门


                                                        tradeData.setOrCNY_12(strategy.getOrCNY_12());
                                                        tradeData.setOrUSD_12(strategy.getOrUSD_12());

                                                        tradeData.setOrCNY_3(strategy.getOrCNY_3());
                                                        tradeData.setOrUSD_3(strategy.getOrUSD_3());

                                                        tradeData.setOrCNY_6(strategy.getOrCNY_6());
                                                        tradeData.setOrUSD_6(strategy.getOrUSD_6());

                                                    }

                                                } else if (p.getPackageType().equals("4")) {

                                                    //半年包

                                                    //特价
                                                    if (p.getSalesType().equals("1")) {
                                                        tradeData.setOrCNY_6(strategy.getOrCNY_6());
                                                        tradeData.setOrUSD_6(strategy.getOrUSD_6());
                                                        tradeData.setSpCNY_6(strategy.getSpCNY_6());
                                                        tradeData.setSpUSD_6(strategy.getSpUSD_6());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_6()) && StringUtils.isNotBlank(strategy.getSpCNY_6()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_6()) && StringUtils.isNotBlank(strategy.getSpUSD_6())) {
                                                            tradeData.setSaveCNY_6(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_6()) - Double.parseDouble(strategy.getSpCNY_6()))));
                                                            tradeData.setSaveUSD_6(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_6()) - Double.parseDouble(strategy.getSpUSD_6()))));
                                                        }

                                                        tradeData.setOrCNY_12(strategy.getOrCNY_12());
                                                        tradeData.setOrUSD_12(strategy.getOrUSD_12());
                                                        tradeData.setSpCNY_12(strategy.getSpCNY_12());
                                                        tradeData.setSpUSD_12(strategy.getSpUSD_12());
                                                        if (StringUtils.isNotBlank(strategy.getOrCNY_12()) && StringUtils.isNotBlank(strategy.getSpCNY_12()) &&
                                                                StringUtils.isNotBlank(strategy.getOrUSD_12()) && StringUtils.isNotBlank(strategy.getSpUSD_12())) {
                                                            tradeData.setSaveCNY_12(String.format("%.2f", (Double.parseDouble(strategy.getOrCNY_12()) - Double.parseDouble(strategy.getSpCNY_12()))));
                                                            tradeData.setSaveUSD_12(String.format("%.2f", (Double.parseDouble(strategy.getOrUSD_12()) - Double.parseDouble(strategy.getSpUSD_12()))));
                                                        }
                                                    } else { //热门
                                                        tradeData.setOrCNY_6(strategy.getOrCNY_6());
                                                        tradeData.setOrUSD_6(strategy.getOrUSD_6());

                                                        tradeData.setOrCNY_12(strategy.getOrCNY_12());
                                                        tradeData.setOrUSD_12(strategy.getOrUSD_12());

                                                    }
                                                }
                                                tradeDataList.add(tradeData);

                                            }
                                        }


                                    }

                                }

                            }

                            ResponseSimpleHomePageNewData data = new ResponseSimpleHomePageNewData();
                            data.setConnSeqNo(ConnSeqNo);
                            data.setPartnerCode(partnerCode);
                            data.setTradeType(tradeType);
                            data.setTradeTime(tradeTime);
                            data.setTradeData(tradeDataList);
                            data.setTradeRstCode("0000");
                            if (lang.equals("cn") || StringUtils.isBlank(lang)) {
                                data.setTradeRstMessage("成功");
                            } else {
                                data.setTradeRstMessage("success");
                            }

                            ResponseSimpleHomePageNew response = new ResponseSimpleHomePageNew();
                            response.setData(data);
                            response.setSign(Md5Encrypt.md5(JSON.toJSONString(data)));

                            jsonString = JSON.toJSONString(response);
                            log.info("【新-精简版的首页】成功响应：" + jsonString);
                            return jsonString;

                        }


                    }
                }
            }
        }

    }

}
